Previous Book Contents Next

Inside Macintosh: Using JBindery


Executing a Java Application

You can also use JBindery to simply execute a Java application rather than package it. In such cases, JBindery acts as the wrapper application that sets up the Java virtual machine and calls the main method.

For example, to simply run the sample HelloWorld application, you can do the following:

  1. Drag the class file HelloWorld.class onto the JBindery icon. JBindery launches, and HelloWorld is listed as the class name in the Command panel.
  2. Select the Run button (or simply hit the Return key).

JBindery then executes the HelloWorld application.

To execute a more sophisticated Java application, you should observe the following steps:

  1. Drag the class file or .zip package containing the application's main method onto the JBindery icon. Alternatively, you can launch JBindery and then enter the class name manually in the Command panel.
  2. In the Command panel, enter any parameters your application requires and choose paths for console output and input.
  3. In the Classpath panel, enter the search paths to include when looking for Java classes.
  4. In the Properties panel, enter any property/value pairs you want to include with your application.
  5. In the Appearance panel, select any desired appearance features.
  6. In the Security panel, specify any proxy servers, if desired, and choose whether you want to use the code verifier.
  7. In any of the panels, select the Run button (or press the Return key) to execute the Java application.

JBindery quits automatically when you exit the Java application. In cases where you might want to run the Java application repeatedly (for example, for tests during development) you can save a JBindery settings file. To do so, simply select Save Settings... from any of the panels after following steps 1 through 6. When the save dialog box appears, choose a name for the settings file, but do not select the Save as Application checkbox.

Important

If you move your settings file to another computer, the Finder may not be able to resolve any class paths stored as aliases.

The saved settings are stored as a JBindery document. Double-clicking on the document icon automatically launches JBindery, which then reads in the settings. To run the Java application with stored settings, you must then select the Run button in any panel.

You can also store frequently used settings by saving them as defaults using the File menu. The default settings (which are stored as a JBindery document in the Preferences folder) are then loaded whenever you launch JBindery directly (that is, when double-clicking or opening the JBindery application itself).

Important

The Finder considers JBindery to be the executing application when you use it to simply execute Java applications. For example, if you specified a class path using the variable /$APPLICATION /, the path is relative to the location of JBindery, not the location of the Java application's classes.


Previous Book Contents Next

© Apple Computer, Inc.
06 AUGUST 1998